
const userMixin = {
  data() {
    return {
      userList: [],
      factoryList: [],
      deviceTypeList: []
    }
  },
  created() {
    // this.getUserList()
  },
  methods: {
    getUserList() {
      this.$api.user.findPage({}).then(res => {
        if (res.code === this.$code) {
          this.userList = res.data.content
        }
      })
    },
    // 获取厂房
    getFactoryList() {
      return this.$api.systemBase.getFactoryList({}).then(res => {
        if (res.code === this.$code) {
          this.factoryList = res.data.content
        }
      })
    },
    // 获取子项
    getTypeList(type, id, list) {
      return this.$api.systemBase.getTypeList({ type, id }).then(res => {
        if (res.code === this.$code) {
          this[list] = res.data.data
        }
      })
    }
  }
}

export default userMixin
